/*
    优先队列，底层依赖堆实现
 */
public class priorityQueue<E extends  Comparable<E>> implements Queue<E>{

    //优先队列底层依赖堆
    private MaxHeap<E> maxHeap;

    public priorityQueue(){
        maxHeap= new MaxHeap<>();
    }


    @Override
    public void enqueue(E e) {
        maxHeap.add(e);
    }

    @Override
    public E dequeue() {
        return maxHeap.extractMax();
    }

    @Override
    public E getFront() {
        return maxHeap.findMax();
    }

    @Override
    public int getSize() {
        return maxHeap.size();
    }

    @Override
    public boolean isEmpty() {
        return maxHeap.isEmpty();
    }
}
